using System;
using System.ComponentModel;
using System.Transactions;

using SIS.ENT;
using SIS.DAL;


/// <summary>
/// The DrivingLicenceTypeTableManager class is responsible for managing BO.DrivingLicenceTypeTable objects in the system.
/// </summary>
[DataObjectAttribute()]
public class DrivingLicenceTypeTableManager
  {

#region "Public Methods"

/// <summary>
/// Gets a list with all DrivingLicenceTypeTable objects in the database.
/// </summary>
/// <returns>A list with all DrivingLicenceTypeTable from the database when the database contains any, or null otherwise.</returns>
[DataObjectMethod(DataObjectMethodType.Select, true)]
public static DrivingLicenceTypeTableList GetList(){
return DrivingLicenceTypeTableDB.GetList();
}

/// <summary>
/// Gets a single DrivingLicenceTypeTable from the database without its data.
/// </summary>
/// <param name="drivingLicenceTypeCode">The DrivingLicenceTypeCode of the DrivingLicenceTypeTable in the database.</param>
/// <returns>A DrivingLicenceTypeTable object when the DrivingLicenceTypeCode exists in the database, or <see langword="null"/> otherwise.</returns>
[DataObjectMethod(DataObjectMethodType.Select, false)]
public static DrivingLicenceTypeTable GetItem(short drivingLicenceTypeCode){
return GetItem(drivingLicenceTypeCode, false);
}

/// <summary>
/// Gets a single DrivingLicenceTypeTable from the database.
/// </summary>
/// <param name="drivingLicenceTypeCode">The DrivingLicenceTypeCode of the DrivingLicenceTypeTable in the database.</param>
/// <param name="getDrivingLicenceTypeTableRecords">Determines whether to load all associated DrivingLicenceTypeTable records as well.</param>
/// <returns>
/// A DrivingLicenceTypeTable object when the DrivingLicenceTypeCode exists in the database, or <see langword="null"/> otherwise.
/// </returns>
[DataObjectMethod(DataObjectMethodType.Select, false)]
public static DrivingLicenceTypeTable GetItem(short drivingLicenceTypeCode, bool getDrivingLicenceTypeTableRecords){
DrivingLicenceTypeTable myDrivingLicenceTypeTable = DrivingLicenceTypeTableDB.GetItem(drivingLicenceTypeCode);
return myDrivingLicenceTypeTable;
}

/// <summary>
/// Saves a DrivingLicenceTypeTable in the database.
/// </summary>
/// <param name="myDrivingLicenceTypeTable">The DrivingLicenceTypeTable instance to save.</param>
/// <returns>The new DrivingLicenceTypeCode if the DrivingLicenceTypeTable is new in the database or the existing DrivingLicenceTypeCode when an item was updated.</returns>
[DataObjectMethod(DataObjectMethodType.Update, true)]
public static Int16 Save(DrivingLicenceTypeTable myDrivingLicenceTypeTable){
using (TransactionScope myTransactionScope = new TransactionScope()){
Int16 drivingLicenceTypeTableDrivingLicenceTypeCode = DrivingLicenceTypeTableDB.Save(myDrivingLicenceTypeTable);

//  Assign the DrivingLicenceTypeTable its new (or existing DrivingLicenceTypeCode).
myDrivingLicenceTypeTable.DrivingLicenceTypeCode = drivingLicenceTypeTableDrivingLicenceTypeCode;

myTransactionScope.Complete();

return drivingLicenceTypeTableDrivingLicenceTypeCode;
}
}

/// <summary>
/// Deletes a DrivingLicenceTypeTable from the database.
/// </summary>
/// <param name="myDrivingLicenceTypeTable">The DrivingLicenceTypeTable instance to delete.</param>
/// <returns>Returns true when the object was deleted successfully, or false otherwise.</returns>
[DataObjectMethod(DataObjectMethodType.Delete, true)]
public static bool Delete(DrivingLicenceTypeTable myDrivingLicenceTypeTable){
return DrivingLicenceTypeTableDB.Delete(myDrivingLicenceTypeTable.DrivingLicenceTypeCode);
}

#endregion

}

